<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>我的订单</title>
	<% include  ../template/commonCss.ejs %>
	<link href="<%=resUrl%>/css/order/index.css" rel="stylesheet" type="text/css" />
	<link href="<%=resUrl%>/css/my/receive_address.css" rel="stylesheet" type="text/css" />
	<% include ../template/commonJs.ejs %>
	<% include ../template/chatLister.ejs %>
	<script>
		var orderStates= '<%-orderState || -1%>';
	</script>
</head>

<body ontouchstart> 
	<% var topTitle = '我的订单';var topReturnType = '';var returnUrl = '/my'%>
	<% include ../template/topReturn.ejs %>

	
	<div class="weui-tab" >
		<!-- <div class="order-sousuo"><i class="iconfont icon-sousuo"></i>　</div> -->
		<div class="tabs" <%if(locals.token && token != ''){%>style="top:0;"<%}%> >
			<a class="item last <%if(orderState==-1){%>current<%}%>" href="javascript:" data-state="-1">
				全部
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==0){%>current<%}%>" href="javascript:" data-state="0">
				待付款
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==10){%>current<%}%>" href="javascript:" data-state="10">
				待发货
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==20){%>current<%}%>" href="javascript:" data-state="20">
				待收货
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==30){%>current<%}%>" href="javascript:" data-state="30">
				待评价
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState=='31,32'){%>current<%}%>" href="javascript:" data-state="31,32">
				退款中
				<div class="v-line"></div>
			</a>
		</div>
		<div id="aroundBox" <%if(locals.token && token != ''){%>style="top:0.2rem;"<%}%>>
			<div class="weui-pull-to-refresh__layer" style="padding: 5px;">
				<div class="weui-pull-to-refresh__arrow"></div>
				<div class="weui-pull-to-refresh__preloader"></div>
				<div class="down">下拉刷新</div>
				<div class="up">释放刷新</div>
				<div class="refresh">正在刷新</div>
			</div>
			<div id="contentTo" >
				<!-- content -->
			</div>
			<div class="weui-loadmore" id="loadmore">
				<i class="weui-loading"></i>
				<span class="weui-loadmore__tips">正在加载</span>
			</div>
			<div class="weui-loadmore weui-loadmore_line" style="display:none;" id="nomore">
				<span class="weui-loadmore__tips">全部加载完毕</span>
			</div>
			
		</div>
	</div>	
	<div id="pay_deposit" class='weui-popup__container' <%if(!locals.token){%>style="top:0.8rem;"<%}%> >
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<header class='demos-header'>
				<h1 class="demos-title">你还没支付</h1>
			</header>
			<div class="weui-cells weui-cells_form">
				<div class="weui-cell">
					<div class="weui-cell__hd"><label class="weui-label">应支付金额</label></div>
					<div class="weui-cell__bd ">
						￥<span id="payMoney">0</span>
					</div>
				</div>
				<div class="weui-cells__title">选择支付方式</div>
				<div class="weui-cells weui-cells_radio">
					<label class="weui-cell weui-check__label" for="x11">
						<div class="weui-cell__bd">
							<p>
								<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#06648C" d="M553.746286 886.381714c-89.581714 0-180.882286-2.285714-186.624-2.432-3.968 0.237714-133.010286 7.058286-179.547429-81.499428-49.846857-64.950857-39.643429-249.344 18.834286-331.428572a375.826286 375.826286 0 0 1 116.772571-106.112c-12.214857-21.467429-29.659429-59.867429-28.745143-103.094857 1.462857-68.864 58.020571-122.477714 107.867429-127.524571a18.285714 18.285714 0 1 1 3.675429 36.406857c-34.56 3.492571-73.965714 43.538286-74.989715 91.904-1.115429 52.352 32.566857 97.901714 32.914286 98.358857a18.358857 18.358857 0 0 1-7.259429 27.721143c-0.694857 0.310857-68.699429 30.939429-120.466285 103.570286-52.132571 73.179429-56.630857 242.066286-18.944 288.804571a17.517714 17.517714 0 0 1 2.066285 3.218286c34.907429 68.809143 146.102857 63.104 147.181715 63.158857 3.657143 0.018286 212.242286 5.229714 309.302857 0.091428 142.482286-34.523429 151.826286-130.413714 148.955428-217.929142-18.048-122.861714-123.008-193.572571-179.437714-231.625143-27.885714-18.816-39.442286-26.605714-40.758857-40.265143a21.028571 21.028571 0 0 1 6.089143-16.950857 18.121143 18.121143 0 0 1 5.796571-3.913143c39.698286-16.877714 66.304-48.384 71.131429-84.278857 4.242286-31.542857-8.996571-61.494857-37.302857-84.534857-45.220571-22.198857-84.864-25.270857-117.778286-9.142858-69.796571 34.249143-91.867429 142.390857-92.086857 143.469715a18.285714 18.285714 0 0 1-35.894857-7.094857c1.042286-5.174857 25.984-127.085714 111.872-169.216 44.16-21.650286 95.305143-18.230857 151.972571 10.112 1.133714 0.566857 2.176 1.243429 3.163429 2.011428 39.259429 31.049143 58.331429 74.514286 52.315428 119.241143-5.577143 41.398857-31.414857 78.061714-70.656 101.668571 4.022857 2.779429 8.411429 5.741714 12.598857 8.557715 56.923429 38.381714 175.414857 118.217143 195.364572 257.737143a17.974857 17.974857 0 0 1 0.164571 1.974857c2.322286 68.809143 7.168 212.004571-178.614857 256.109714a17.737143 17.737143 0 0 1-3.218286 0.457143c-33.371429 1.846857-79.305143 2.468571-125.714285 2.468571zM640.347429 560.310857a9.142857 9.142857 0 0 1-9.142858-8.886857c-3.657143-138.093714-69.357714-181.321143-70.016-181.741714a9.161143 9.161143 0 0 1 9.691429-15.506286c3.035429 1.883429 74.678857 47.963429 78.628571 196.754286a9.179429 9.179429 0 0 1-8.886857 9.398857l-0.274285-0.018286zM563.510857 522.441143a9.142857 9.142857 0 0 1-8.777143-11.757714c10.898286-36.534857-22.710857-116.845714-36.571428-144.713143a9.142857 9.142857 0 0 1 16.365714-8.137143c2.176 4.352 52.918857 107.209143 37.741714 158.061714a9.142857 9.142857 0 0 1-8.758857 6.546286zM340.169143 343.625143h292.571428v36.571428h-292.571428v-36.571428zM640.347429 540.269714a18.285714 18.285714 0 1 1 0 36.571429 18.285714 18.285714 0 1 1 0-36.571429zM560.475429 506.550857a18.285714 18.285714 0 1 1 0 36.571429 18.285714 18.285714 0 1 1 0-36.571429zM364.16 613.412571a18.285714 18.285714 0 0 1 18.285714 18.285715v164.571428a18.285714 18.285714 0 1 1-36.571428 0v-164.571428a18.285714 18.285714 0 0 1 18.285714-18.285715zM288.365714 613.412571h146.285715a18.285714 18.285714 0 1 1 0 36.571429h-146.285715a18.285714 18.285714 0 1 1 0-36.571429zM309.302857 677.412571h109.714286a18.285714 18.285714 0 1 1 0 36.571429h-109.714286a18.285714 18.285714 0 1 1 0-36.571429zM300.141714 548.443429l77.568 77.604571a18.267429 18.267429 0 1 1-25.856 25.856L274.285714 574.336a18.304 18.304 0 0 1 25.856-25.892571zM424.100571 550.509714l-74.459428 74.496a17.536 17.536 0 1 0 24.813714 24.813715l74.459429-74.459429a17.572571 17.572571 0 0 0-24.813715-24.850286z" /></svg>
								钱包余额支付</p>
						</div>
						<div class="weui-cell__ft">
							<input type="radio" class="weui-check" name="radioPay" id="x11" value="1">
							<span class="weui-icon-checked"></span>
						</div>
					</label>
					<label class="weui-cell weui-check__label" for="x12">
						<div class="weui-cell__bd">
							<p>
								<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#388E04" d="M302.848897 308.186411c-18.67874 0-38.84109 12.091062-38.84109 31.622698 0 19.609452 20.16235 31.745564 38.84109 31.745565 18.946998 0 31.672869-12.758635 31.672869-31.741469-0.01843-19.213208-12.454541-31.626794-31.672869-31.626794zM495.296335 371.555698c19.005359 0 31.777305-12.758635 31.777305-31.745565 0-19.210136-12.471947-31.622698-31.777305-31.622698-18.62857 0-38.741773 12.091062-38.741773 31.618603 0.022525 19.612523 20.126514 31.74966 38.741773 31.74966z"  /><path fill="#388E04" d="M903.969923 594.310141c0-107.183387-97.655111-198.754571-222.319292-208.468171l-0.690099-0.054266-2.091797-7.80303-0.031741 0.01843c-25.385189-113.782328-148.247332-199.386309-286.672532-199.386309-157.09063 0-284.894044 109.365287-284.894044 243.793239 0 71.907466 36.881373 137.009167 106.666325 188.268962l1.542995 1.134465-25.185531 75.718367c-1.256307 3.825236-0.113651 7.994497 2.894524 10.612572a10.001312 10.001312 0 0 0 6.505767 2.418417 10.14056 10.14056 0 0 0 4.437519-1.043339l93.113156-46.600093 12.572287 2.549474c28.175276 5.789048 52.502792 10.784584 82.347002 10.784585 8.706097 0 17.635401-0.380885 26.55037-1.14368l11.969219-1.650503c34.350329 83.986242 126.465196 140.329627 229.869423 140.329627 26.496104 0 53.015758-6.089046 80.110836-12.871263l0.998288-0.249828 72.052858 39.385797a9.917353 9.917353 0 0 0 4.749804 1.229686 9.870255 9.870255 0 0 0 6.210888-2.191114c3.144352-2.549474 4.419089-6.678804 3.243669-10.525541l-18.683859-62.139601 1.401699-1.111939c60.189099-47.555378 93.332267-104.736302 93.332266-161.004944z m-590.440878 41.700802l-15.765786-3.185307a9.499608 9.499608 0 0 0-1.964836-0.208873 9.514966 9.514966 0 0 0-4.351513 1.061769l-74.833731 37.461916 19.977027-60.020157c1.392484-4.187691-0.104436-8.706097-3.71568-11.243285-70.210888-48.936599-105.808309-108.643448-105.808309-177.465948 0-123.516406 118.925304-224.00256 265.099268-224.00256 128.697266 0 243.552626 78.858624 267.172637 183.423937l0.712624 3.170973-3.248788 0.040955c-132.39042 1.733438-240.095989 95.609388-240.095989 209.266802 0 15.566129 2.277121 31.782424 6.774025 48.20145l0.576448 1.390436-6.792456 1.472347h-0.235493a290.576607 290.576607 0 0 1-24.835363 1.065865c-28.167085 0-51.574128-4.836834-78.664085-10.43032z m474.805318 119.514038l13.701633 45.570064-54.294591-29.703937a9.814965 9.814965 0 0 0-4.736494-1.220471c-0.834467 0-1.623882 0.099317-2.413297 0.317404-26.19713 6.619419-53.292207 13.46614-80.010495 13.46614-123.548147 0-224.056826-85.087942-224.056826-189.670661 0-104.569408 100.508679-189.648135 224.056826-189.648135 121.202425 0 223.599149 86.848001 223.599149 189.648135 0 52.284704-32.788904 105.735614-92.32374 150.489641a9.94807 9.94807 0 0 0-3.522165 10.75182z"  /><path fill="#2c2c2c" d="M735.886861 507.54917c-12.227239 0-24.68178 12.594813-24.68178 24.958229 0 12.313245 12.454541 24.858912 24.68178 24.858912 19.686243 0 31.872526-12.903003 31.872526-24.858912 0-12.005055-12.186283-24.958229-31.872526-24.958229zM584.716336 507.54917c-12.327579 0-24.885533 12.594813-24.885533 24.958229 0 12.313245 12.558977 24.858912 24.885533 24.858912 19.581807 0 31.700514-12.903003 31.700513-24.858912 0-12.005055-12.118707-24.958229-31.700513-24.958229z"  /></svg>
								微信支付</p>
						</div>
						<div class="weui-cell__ft">
							<input type="radio" name="radioPay" class="weui-check" id="x12" value="2" checked="checked">
							<span class="weui-icon-checked"></span>
						</div>
					</label>
				</div>
				<div class="weui-cell">
					<input type="hidden" id="payId">
					<a href="javascript:;" class="weui-btn weui-btn_primary close-popup ok" id="confirmBondPay">确认支付</a>
					<a href="javascript:;" class="weui-btn weui-btn_primary close-popup cancel">取消支付</a>
				</div>
			</div>
		</div>
	</div>	
	<div id="select_adress" class='weui-popup__container' <%if(!locals.token){%>style="top:0.8rem;"<%}%>>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal address" id='adressContent' >
		 
		</div>
	</div>	
	<script id="content" type="text/html">
		{{each list}}
		<div class="shoplist-item">
			<div class="shoplist-item-top">	
				{{if $value.shopDetail}}
					<img class="shoplist-item-logo" src="{{$value.shopDetail.image}}" alt="">
					<a href="javascript:visitUrl('/shop/detail?id={{$value.shopDetail.id }}',true)"><span>{{$value.shopDetail.name }} ></a>
					{{if $value.state == 0}}
					<div class="order-top-rig order-top-orange">待付款</div>
					{{else if $value.state == 10}}
					<div class="order-top-rig">待发货</div>
					{{else if $value.state == 20}}
					<div class="order-top-rig order-top-orange">待收货</div>
					{{else if $value.state == 30}}
					<div class="order-top-rig order-top-orange">待评价</div>
					{{else if $value.state == 31}}
					<div class="order-top-rig order-top-orange">申请退款中</div>
					{{else if $value.state == 32}}
					<div class="order-top-rig order-top-orange">退款中</div>
					{{else if $value.state == 33}}
					<div class="order-top-rig order-top-orange">卖家拒绝退款</div>
					{{else if $value.state == 34}}<!--已退款-->
					<div class="order-top-rig">交易关闭</div>
					{{else if $value.state == 40}}
					<div class="order-top-rig">交易完成</div>
					{{else if $value.state == 99}}
					<div class="order-top-rig">交易关闭</div>
					{{/if}}
				{{/if}}
			</div>
			<a href="javascript:visitUrl('/order/detail?id={{$value.id}}',true)">
			<div class="shoplist-item-body">
				<div class="order-body-let" style="width:1.68rem;height:1.68rem;background: url({{$value.productDetail.coverImage}}?x-oss-process=image/resize,w_500) no-repeat 0 center;background-size: 100% auto;border:1px solid #DDDDDD;">
				</div>	
				<div class="order-body-cen">
					<div class="order-pro-name">{{$value.productDetail.name}}</div>
					<div class="auto-height"></div>
					{{if $value.tradeType  == 1}}
					<div class="order-img order-img-pai"></div>
					{{/if}}
					{{if $value.shopDetail && $value.shopDetail.marginAuthentication == 1}}
					<div class="order-img order-img-bao"></div>
					{{/if}}
				</div>	
				<div class="order-body-rig">
						<div>￥{{$value.productDetail.price}}</div>
						<div class="order-pro-number">x{{$value.productDetail.count}}</div>
				</div>	
				<div class="auto-height"></div>
				<div class="order-count" >共{{$value.productDetail.count}}件商品  合计:{{$value.payMoney}}</div>	
			</div>
			</a>
			<div class="order-bottom" >
					{{if $value.state == 0}}
					<div class="order-bots order-bots-orange" onclick="delayPay('{{$value.id}}');" >延迟付款</div>	
					<div class="order-bots order-bots-orange" onclick="payOrder('{{$value.id}}','{{$value.payMoney}}');">立即付款</div> 
					{{else if $value.state == 10}}
						<a href="javascript:visitUrl('/selectAddress?orderId={{$value.id}}')">
						<div class="order-bots order-bots-orange" >更新收货地址</div> 
						</a>
					<!-- 待发货 -->
					{{else if $value.state == 20}}
					<!-- 待收货 -->
					<a href="javascript:visitUrl('/order/applyRefund?id={{$value.id}}',true)">
					<div class="order-bots">申请退款</div>
					</a>
					<div class="order-bots order-bots-orange" onclick="sureReceive('{{$value.id}}');" >确认收货</div>
					{{else if $value.state == 30}}
					<a href="javascript:visitUrl('/add_evaluate?id={{$value.id}}',true)">
					<div class="order-bots order-bots-orange" >立即评价</div>
					</a>
					{{else if $value.state == 31}}
					<!-- 申请退款（待确认） -->
					<a href="javascript:visitUrl('/order/refundDetail?id={{$value.id}}',true)">
						<div class="order-bots order-bots-orange" >退款详情</div>
					</a>
					{{else if $value.state == 32}} <!-- 卖家同意退款 -->
					
					{{else if $value.state == 33}}
					<!-- 买家退货（待收货） -->
					<a href="javascript:visitUrl('/order/applyRefund?id={{$value.id}}',true)">
					<div class="order-bots" >申请退款</div>
					</a>
					{{else if $value.state == 34}}
					<!-- 卖家收货 -->
					{{else if $value.state == 40}}
					<!-- 已评价 -->
					{{else if $value.state == 99}}
					<!-- 交易关闭 -->
					{{/if}}
			</div>	
		</div>
		{{/each}}
	</script>
	<script id="adressContenTo" type="text/html">
		<header class='demos-header'>
			<h1 class="demos-title">选择收货地址</h1>
		</header>
		{{each list}}
		<div data-aid="{{$value.id}}" class="item {{if $value.isDefault == 1}}current{{/if}}">
			<div class="name">{{$value.name}}</div>
			<div class="info">
				<div class="row">{{$value.areaNames}}</div>
				<div class="row">{{$value.address}}</div>
				<div class="row">联系电话：{{$value.phone}}</div> 
			</div>
			<div class="state">
				<i class="iconfont icon-dagoux" style="font-size:0.6rem;"></i>
			</div>
			<div class="auto-height"></div>
		</div>
		{{/each}}
		<div class="weui-btn-area">
			<a class="weui-btn weui-btn_mini weui-btn_primary" href="javascript:visitUrl('/receive_address',true)">去添加</a> 
			{{if list}}
			<a class="weui-btn weui-btn_mini weui-btn_primary" href="javascript:" onclick="choseAdree('{{orderId}}','{{money}}');">确定</a>
			{{/if}} 
			<a class="weui-btn weui-btn_mini weui-btn_default" href="javascript:" onclick="closePopup();">取消</a>
		</div>
	</script>	
	<script type="text/javascript" src="<%=resUrl%>/lib/md5.js"></script>	
	<script type="text/javascript" src="<%=resUrl%>/js/order/index.js"></script>
</body>

</html>